package wangwenjun.phase2.concurrencypattern.activeobject.staticproxy.framework;

import wangwenjun.phase2.concurrencypattern.activeobject.staticproxy.OrderService;

/**
 * @author ChangLiang
 * @date 2020/6/17
 */
public class OrderServiceFactory {

    /**
     * 将OrderServiceMessageQueue 定义成static 的目的是，
     * 保持其在整个JVM 进程中是唯一的，并且OrderServiceDaemonThread 会在此刻启动
     */
    private final static OrderServiceMessageQueue queue = new OrderServiceMessageQueue();

    private OrderServiceFactory() {

    }

    /**
     * 用于创建OrderServiceProxy
     * @param orderService
     * @return
     */
    public static OrderService createActiveObject(OrderService orderService) {
        return new OrderServiceProxy(orderService, queue);
    }
}
